<?php 

header("Content-type: text/html; charset=utf-8");
$info='';

$data=current($_FILES);
		for ($i=0; $i <count($data['name']) ; $i++) { 

		if ($data['error'][$i]==0) {
			if ($data['size'][$i]<1000000) {
				$dou=explode('.', $data['name'][$i]);
				//吧字符串打成数组
				$jiewei=end($dou);
		//输出数组中的当前元素和最后一个元素的值
				if ($jiewei=="jpg" or $jiewei=="png" or $jiewei=="gif") {
					$name=uniqid();
		move_uploaded_file($data['tmp_name'][$i], './wenjian/'.$name.".".$jiewei);
				}else{
					$info = "上传的格式不正确";
				}
			}else{
				$info = "上传的文件过大了";
			}
		}else{
			$info= "上传出了一个致命的错误".$data['error'][$i];
		};
		 
		
		};
		
		


header("location:./upload1.php?info=".$info);










 ?>